// app.js
// 引入 Calculator 类
// const Calculator = require("./calculator");
import Calculator from "./calculator";

// 创建一个 Calculator 实例
const calculator = new Calculator();

// 使用 Calculator 类的方法
console.log("加法: 5 + 3 =", calculator.add(5, 3));
console.log("减法: 5 - 3 =", calculator.subtract(5, 3));
console.log("乘法: 5 * 3 =", calculator.multiply(5, 3));
console.log("除法: 6 / 3 =", calculator.divide(6, 3));

// 尝试除以零，捕获错误
try {
  console.log("除法: 6 / 0 =", calculator.divide(6, 0));
} catch (error) {
  console.error(error.message);
}
